from PyQt6.QtCore import QObject, pyqtSignal

class DataSender(QObject):
    # 定义带字符串参数的信号
    text_signal = pyqtSignal(str)
    # 定义带多个参数的信号
    data_signal = pyqtSignal(int, float, str)
    
    def send_data(self):
        self.text_signal.emit("重要通知！")
        self.data_signal.emit(42, 3.14, "参数示例")

class DataReceiver(QObject):
    def show_text(self, message):
        print(f"收到文本: {message}")
    
    def show_data(self, num, value, desc):
        print(f"收到数据: {num}, {value}, {desc}")

# 使用示例
sender = DataSender()
receiver = DataReceiver()

sender.text_signal.connect(receiver.show_text)
sender.data_signal.connect(receiver.show_data)

sender.send_data()
